package com.action;

import com.pojo.City;
import com.service.CityService;
import com.vo.ResponseBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin("*")
public class CityAction {

    @Autowired
    private CityService cityService;

    /**
     * 根据已选省份查询所有城市
     * @param provinceCode 省份code
     * @return
     */
    @RequestMapping("/findCity")
    public ResponseBean findCity(String provinceCode){
        List<City> list = cityService.findCity(provinceCode);
        if (list != null){
            return new ResponseBean(200,0,list);
        }
        return new ResponseBean(500,0,"查询失败");
    }
}
